<div id="messageContainer">
	<p style="border-bottom:3px solid #000;padding-bottom:5px;font-weight:bold;">INBOX</p>
	<?if($myinbox):?>
		<table class="table">
			<tr class="info">
				<td><span class="label label-inverse">Date:</span></td>
				<td><span class="label label-inverse">From:</span></td>
				<td><span class="label label-inverse">To:</span></td>
				<td><span class="label label-inverse">Title:</span></td>
				<td></td>
			</tr>
			<?foreach($myinbox as $k => $v):?>
				<?
					if(isset($v['recipients']) && $v['recipients']){
						foreach($v['recipients'] as $vv)
						{
							$recipients[$k][] = strtolower($vv->recipient);
						}
					}
					if($recipients)
					{
						$f_rec = implode(' , ',array_map('ucwords',$recipients[$k]));
					}else{
						$f_rec = 'None';
					}
				?>
				<tr>
					<td><?=$v['data']->msg_created;?></td>
					<td><?php if($v['data']->sender_id == $this->session->userdata('userid')){
								echo '<b>ME</b>';
							  }else{
								echo ucwords(strtolower($v['data']->origin)); 
							  } ?>
					</td>
					<td><span data-tooltip class="has-tip" title="<?=$f_rec;?>">
					<?php
					if(sizeof($recipients[$k]) <= 1){
						echo $f_rec;
					}else{
						echo 'Others';
					}
					?>
					</span></td>
					<td><?=$v['data']->title;?></td>
					<td>
						<div class="btn-group">
							<a href="<?=site_url('message/thread/'.__link($v['data']->thread_id));?>" class="btn btn-mini" data-tooltip class="has-tip" title="View this message thread"><i class="icon-eye-open"></i></a>
							<?if($v['data']->sender_id != $this->session->userdata('userid')):?>
								<a href="<?php echo site_url('message/remove_me/'.__link($v['data']->thread_id)); ?>" class="btn btn-mini" data-tooltip class="has-tip" title="Remove me from this thread"><i class="icon-remove"></i></a>
							<?else:?>
								<?if($count_viewer($v['data']->thread_id) <= 1):?>
									<a href="<?php echo site_url('message/delete/'.__link($v['data']->thread_id)); ?>" class="btn btn-mini" data-tooltip class="has-tip" title="Delete this thread"><i class="icon-remove"></i></a>
								<?else:?>
									<a href="<?php echo site_url('message/remove_me/'.__link($v['data']->thread_id)); ?>" class="btn btn-mini" data-tooltip class="has-tip" title="Remove me from this thread"><i class="icon-remove"></i></a>
								<?endif;?>
							<?endif;?>
							<!-- <a href="#" class="btn btn-mini" data-tooltip class="has-tip" title="Remove Me From this Thread"><i class="icon-remove"></i></a> -->
							<!-- <a href="#" class="btn btn-mini" data-tooltip class="has-tip" title="Reply To this Thread"><i class="icon-comment"></i></a> -->
							<!-- <a href="#" class="btn btn-mini" data-tooltip class="has-tip" title="Reply To The Sender Only."><i class="icon-envelope"></i></a> -->
						</div>
					</td>
				</tr>
			<?endforeach;?>
		</table>
	<?else:?>
		<div class="alert-box">No New Message</div>
	<?endif;?>
</div>